<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>认证中心登录页面</title>
</head>
<body>
<div style="width:800px;margin:0 auto">
    <input type="text" value="" id="name"/><br/>
    <input type="password" value="" id="password"/><br/>
    <button id="login" onclick="doLogin()">登录</button>
</div>

<script src="main.js"></script>
<script src="jquery-1.8.0.min.js"></script>
<script>
    function doLogin() {
        var name = $('#name').val();
        var password = $('#password').val();
        $.ajax({
            type: 'post',
            url: "/sso/login",
            contentType: "application/json",
            dataType: 'json',
            data: JSON.stringify({name: name, password: password}),
            success: function (res) {
                if (res.code === 200) {
                    localStorage.setItem("token", res.token);
                    alert("登录成功，跳转到回调地址");
                    console.log( getUrlParam("redirect") + "?token=" + res.token)
                    window.location.href = getUrlParam("redirect") + "?token=" + res.token;
                } else {
                    alert("账号密码错误");
                }
            }
        })
    }
</script>
</body>
</html>